﻿<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeBehind="DetailDesignManagement.aspx.cs" Inherits="PMP.Operations.DetailDesignManagement" %>

<%@ Register assembly="FreeTextBox" namespace="FreeTextBoxControls" tagprefix="FTB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Detail Design Operations</title>
    <style type="text/css">
        .style1
        {
            width: 99%;
            height: 73px;
        }
        .style2
        {
            text-align: right;
        }
        .style3
        {
            color: #FF9933;
        }
        .style4
        {
            font-weight: bold;
            color: #FFFFFF;
            background-color: #0066FF;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table class="style1">
            <tr>
                <td class="style2">
                    Goal:</td>
                <td>
                <asp:TextBox ID="txtGoal" runat="server" Width="296px"></asp:TextBox>
                <asp:TextBox ID="txtGoalID" runat="server" Width="296px" Visible="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Author:</td>
                <td>
                <asp:TextBox ID="txtAuthor" runat="server" Width="296px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="text-align: right">
    <asp:Button ID="btnSave" runat="server" 
            onclick="btnSave_Click" Text="Save The Detail Design" style="text-align: right" /> 
                </td>
                <td>
            <asp:Button ID="btnReview" runat="server" 
            onclick="btnReview_Click" Text="Submit to Review" />
            <asp:Button ID="btnApprove" runat="server" 
            onclick="btnApprove_Click" Text="Approve" />
            <asp:Button ID="btnSuggest" runat="server" 
            onclick="btnSuggest_Click" Text="Suggest" />
                    <asp:Button ID="btnRefresh" runat="server" onclick="btnRefresh_Click" 
                        Text="Refresh" />
                    <asp:Button ID="btnQualityStatement" runat="server" onclick="btnQualityStatement_Click" 
                        Text="Quality Statement" />
                </td>
            </tr>
            <tr>
                <td colspan = "2" class="style3">
                    If having trouble viewing images, use IE or Firefox.</td>
            </tr>
        </table>
        <FTB:FreeTextBox ID="ftbDetailDesign" runat="server" Height="450px" Width="100%">
        </FTB:FreeTextBox>
    <p>&nbsp; <span class="style4">Review History</span></p>
    </div>
    <div>
    <asp:GridView ID="grvReviewHistory" runat="server" 
            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
             ForeColor="#333333" GridLines="None" 
            DataKeyNames="ID"  OnRowCommand="grvReviewHistory_RowCommand">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" />
                <asp:ButtonField CommandName="DetailDesignDetails" Text="Details" />
                <asp:BoundField DataField="author" HeaderText="author" 
                    SortExpression="author" />
                <asp:BoundField DataField="goal_id" HeaderText="goal_id" SortExpression="goal_id" />
                <asp:BoundField DataField="Rev" HeaderText="Rev" SortExpression="Rev" />
                <asp:BoundField DataField="design" HeaderText="design" SortExpression="design" 
                    Visible="False" />
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" />
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="dsReview" runat="server" ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
            
            ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>"
        
        
        SelectCommand="SELECT [author]
      ,[goal_id]
      ,[Rev]
      ,[design]
      ,[ID]
  FROM [detaildesign] where to_review = 1" UpdateCommand="UPDATE [detaildesign]
   SET [author] = @author
      ,[goal_id] = @goal_id
      ,[Rev] = @Rev
      ,[design] = @design
 WHERE ID = @ID" DeleteCommand="delete from detaildesign where ID = @ID" >
            <DeleteParameters>
                <asp:Parameter Name="ID" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="author" />
                <asp:Parameter Name="goal_id" />
                <asp:Parameter Name="Rev" />
                <asp:Parameter Name="design" />
                <asp:Parameter Name="ID" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
    <p>&nbsp; <span class="style4">Revision History</span></p>
    <div>
    <asp:GridView ID="grvRevisionHistory" runat="server" 
            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
             ForeColor="#333333" GridLines="None" 
            DataKeyNames="ID"  OnRowCommand="grvRevisionHistory_RowCommand">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" />
                <asp:ButtonField CommandName="DetailDesignDetails" Text="Details" />
                <asp:BoundField DataField="author" HeaderText="author" 
                    SortExpression="author" />
                <asp:BoundField DataField="goal_id" HeaderText="goal_id" SortExpression="goal_id" />
                <asp:BoundField DataField="Rev" HeaderText="Rev" SortExpression="Rev" />
                <asp:BoundField DataField="design" HeaderText="design" SortExpression="design" 
                    Visible="False" />
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" />
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="dsRevision" runat="server" ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
            
        
            ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>"
        
        SelectCommand="SELECT [author]
      ,[goal_id]
      ,[Rev]
      ,[design]
      ,[ID]
  FROM [detaildesign] where to_review &lt;&gt; 1" UpdateCommand="UPDATE [detaildesign]
   SET [author] = @author
      ,[goal_id] = @goal_id
      ,[Rev] = @Rev
      ,[design] = @design
 WHERE ID = @ID" DeleteCommand="delete from detaildesign where ID = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="author" />
                <asp:Parameter Name="goal_id" />
                <asp:Parameter Name="Rev" />
                <asp:Parameter Name="design" />
                <asp:Parameter Name="ID" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
